<?php
namespace ZyucMini\Components\Expert\Models;

use ZyucMini\Core\Model;

// 专家任务处理表
class TaskHandle extends Model
{
    protected $connection = 'uxt';
    protected $table = 'exp_task_handle';

    // 通过任务id获取任务的处理列表
    public function getFinishListByTasks($finishIds)
    {
        if(count($finishIds) === 0) {
            return [];
        }
        $handles = $this->newQuery()
            ->fields('task_id, handle_text')
            ->where('task_id IN ('.implode(',', $finishIds).')', [])
            ->where('handle_status','=', 1)
            ->all();
        
        $handleMaps = [];
        foreach ($handles as $handle) {
            $handleMaps[$handle['task_id']] = $handle['handle_text'];
        }
        
        return $handleMaps;
    }
}
?>